/**
 * 作者：I-AM-WASTE
 * TIME:2022-10-5
 * @type {HTMLElement}
 */

Vue.component('List', {
    name: 'list',
    props: {
        list: Array,
    },
    methods: {
        moreclick(index){
            document.getElementById("moregl"+index+"").style.display = "block"
            document.getElementById("moregl"+index+"").style.left = document.getElementById(""+index+"").offsetLeft+document.getElementById(""+index+"").offsetWidth+10+"px"
        },
        pljb(index){
            axios.post("/gameart/pljbup/"+index).then(function (response){
                if (response.data === "ok"){
                    v.$Message.success({
                        content: "芜湖！举报成功φ(*￣0￣)",
                        duration: 3
                    });
                }else {
                    v.$Message.warning({
                        content: "服务器娘发生错误了(っ °Д °;)っ",
                        duration: 3
                    });
                }
            })
            document.getElementById("moregl"+index+"").style.display = "none"
        },
        moreclose(index){
            document.getElementById("moregl"+index+"").style.display = "none"
        },
        hf(index){
            let username = document.getElementById("userName"+index+"").innerText
            let aitename = "@"+username+"："
            v.up.commentContent = aitename
            v.up.parentId = index
            document.documentElement.scrollTop = document.getElementById("pl").offsetTop;
        },
        linkOne(index){
            var zan = document.getElementById("dianzan"+index+"")
            var zanNum = document.getElementById("zan"+index+"")
            var zN = zanNum.innerText*1
            if (!zan.getAttribute('class').includes('svg-purple')){
                zan.classList.add("svg-purple")
                zanNum.innerHTML = zN+1
                axios.post("/upLike/"+index+"/1").then(function (){
                    axios.post("/artComment/"+v.artId).then(function (response){
                        v.commentList = response.data
                    })
                })
                // console.log("当前赞"+zN)
            }else {
                zan.classList.remove("svg-purple")
                zanNum.innerHTML = zN-1
                axios.post("/upLike/"+index+"/0").then(function (){
                    axios.post("/artComment/"+v.artId).then(function (response){
                        v.commentList = response.data
                    })
                })
                // console.log("当前赞"+zN)
            }
            // console.log("点击了一次"+index)
        },
        plyiru(index){
            document.getElementById("more"+index+"").style.display = "block"
            document.getElementById(""+index+"").classList.remove("pl-bs")
        },
        plyichu(index){
            document.getElementById("more"+index+"").style.display = "none"
        },
    },
    template: `<div>
                        <div class="plq" v-for="(commentList,index) in list" :key="index" v-on="$listeners">
                            <div class="pl-one" :id="commentList.id" @mouseleave="plyichu(commentList.id)" @mouseenter="plyiru(commentList.id)">
                            <div class="user-tx" v-if="commentList.adminType != 1" >
                                <img :src="commentList.userImg" width="60px" height="60px" class="show-box-d-f border_radius">
                            </div>
                            <div class="user-tx user-tx-config" v-if="commentList.adminType === 1">
                                <img :src="commentList.userImg" width="60px" height="60px" class="show-box-d-f border_radius">
                            </div>
                            <div class="user-pl-zt">
                                <div class="user-pl-z">
                                    <div class="user-pl-name">
                                        <span class="c-blue" v-bind:id="'userName'+commentList.id" v-text="commentList.visitorName"></span>
                                        <span class="art-span" v-if="commentList.adminType === 1">UP猪</span>
                                        <div class="gxbq"  v-if="commentList.adminType === 1">
                                            <img :src="commentList.userImg" width="35px"  class="show-box-d-f border_radius">
                                            <div class="bh"><span class="c-purple">NO.<br>00001</span></div>
                                        </div>
                                    </div>
                                    <div class="user-pl-nr" >
                                    <span class="c-pink" v-text="commentList.aite"></span>
                                    <span v-html="commentList.commentContent"></span>
                                    </div>
                                    <div class="user-pl-sj">
                                        <div class="pl-sj-left">
                                            <span>发表于 <span v-text="commentList.addTime"></span></span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <div @click="linkOne(commentList.id)">
                                                <svg v-bind:id="'dianzan'+commentList.id" t="1636093575017" class="icon svg-but-hover" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3323" width="200" height="200"><path d="M594.176 151.168a34.048 34.048 0 0 0-29.184 10.816c-11.264 13.184-15.872 24.064-21.504 40.064l-1.92 5.632c-5.632 16.128-12.8 36.864-27.648 63.232-25.408 44.928-50.304 74.432-86.208 97.024-23.04 14.528-43.648 26.368-65.024 32.576v419.648a4569.408 4569.408 0 0 0 339.072-4.672c38.72-2.048 72-21.12 88.96-52.032 21.504-39.36 47.168-95.744 63.552-163.008a782.72 782.72 0 0 0 22.528-163.008c0.448-16.832-13.44-32.256-35.328-32.256h-197.312a32 32 0 0 1-28.608-46.336l0.192-0.32 0.64-1.344 2.56-5.504c2.112-4.8 5.12-11.776 8.32-20.16 6.592-17.088 13.568-39.04 16.768-60.416 4.992-33.344 3.776-60.16-9.344-84.992-14.08-26.688-30.016-33.728-40.512-34.944zM691.84 341.12h149.568c52.736 0 100.864 40.192 99.328 98.048a845.888 845.888 0
                                            0 1-24.32 176.384 742.336 742.336 0 0 1-69.632 178.56c-29.184 53.44-84.48 82.304-141.76 85.248-55.68 2.88-138.304 5.952-235.712 5.952-96 0-183.552-3.008-244.672-5.76-66.432-3.136-123.392-51.392-131.008-119.872a1380.672 1380.672 0 0 1-0.768-296.704c7.68-72.768 70.4-121.792 140.032-121.792h97.728c13.76 0 28.16-5.504 62.976-27.456 24.064-15.104 42.432-35.2 64.512-74.24 11.904-21.184 17.408-36.928 22.912-52.8l2.048-5.888c6.656-18.88 14.4-38.4 33.28-60.416a97.984 97.984 0 0 1 85.12-32.768c35.264 4.096 67.776 26.88 89.792 68.608 22.208 42.176 21.888 84.864 16 124.352a342.464 342.464 0 0 1-15.424 60.544z m-393.216 477.248V405.184H232.96c-40.448 0-72.448 27.712-76.352 64.512a1318.912 1318.912 0 0 0 0.64 282.88c3.904 34.752 32.96 61.248 70.4 62.976 20.8 0.96 44.8 1.92 71.04 2.816z" p-id="3324">
                                            </path></svg>
                                            </div>&nbsp;
                                            <span v-text="commentList.userLikeNum" v-bind:id="'zan'+commentList.id">0</span>&nbsp;&nbsp;
                                            &nbsp;&nbsp;&nbsp;
                                            <span class="c-blue foot-button-white show-box-d-m button-hover" @click="hf(commentList.id)">回复</span>
                                            <div class="jb"><i class="bi bi-three-dots-vertical"type="button"></i></div>
                                        </div>
                                        <div class="pl-sj-right" @click.stop>
                                            <svg t="1636097794549" @click="moreclick(commentList.id)"  type="button" v-bind:id="'more'+commentList.id" class="icon dis-n icon-button" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5713" width="200" height="200"><path d="M586.624 234.624a74.624 74.624 0 1 1-149.184 0 74.624 74.624 0 0 1 149.12 0z m0 554.624a74.624 74.624 0 1 1-149.248 0 74.624 74.624 0 0 1 149.248 0zM512 586.624a74.624 74.624 0 1 0 0-149.248 74.624 74.624 0 0 0 0 149.248z" p-id="5714" fill="#9499a0"></path></svg>
                                        </div>
                                    </div>
                                </div>
            </div>
        <div class="more-list show-box-m-d dis-n p-a" v-bind:id="'moregl'+commentList.id">
        <div class="more-list-one" >
        <p class="p-def more-xz" @click="pljb(commentList.id)">举报</p>
        <p class="p-def more-xz" @click="moreclose(commentList.id)">关闭</p>
        </div>
        </div>
</div>
<list :list="commentList.childList" ></list>
        </div>
</div>`,
})

let v = new Vue({
    el:"#pl",
    data:{
        adminName:'',
            moreFlag:false,
        commentList:[],
        eomList:[],
        biliList:[],
        // biliListOne:[],
        up:{
            visitorName:'',
            commentContent:'',
            userEmail:'',
            parentId:'',
            aite:''
        },
        like:{
            sleepTime:0
        },
        showBox:false,
        userSet:0,
        artId:'',
        showEomBox:false,
        eomPT:false,
        bilieom:false,
        biliwz:false,
        textData:{
            startText:0,
            endText:0,
            textChaRu:''
        },
        plNew:true,
        plHot:false,
        CX:{
            cxName:''
        },
        CXId: {

        },
        cxIndex:{
            left:0,
            right:1
        },
        cxtable:false
    },
    created:function (){
        this.artId = document.getElementById("artId").value;
        axios.post("/gameart/artComment/"+this.artId).then(function (response){
            v.commentList = response.data
        })
        let getTime = document.getElementById("endTimeGet").innerText
        this.setUpTime(getTime)
        axios.post("/gameart/artComment/"+this.artId+"/adminName").then(function (response){
            v.adminName = response.data
        })
    },
    methods:{
        //0--0
        setUpTime(time){
            let setTime = document.getElementById("endTime")
            let setTime2 = document.getElementById("endTimeGet")
            // let nedTim = getTime.split("-")
            var date = new Date(time);
            var y = date.getFullYear();
            var m = date.getMonth() + 1;
            m = m < 10 ? "0" + m : m;
            var d = date.getDate();
            d = d < 10 ? "0" + d : d;
            setTime2.innerHTML = y + "-" + m + "-" + d;
            setTime.innerHTML = y + "-" + m + "-" + d;
        },
        nextleft(){
            if (v.CXId !==undefined && v.CXId != null  && v.CXId.length > 0){
                if (v.cxIndex.left <= 0){
                    v.$Message.warning({
                        content: "当前已经是第一个了(っ °Д °;)っ",
                        duration: 3
                    });
                    v.cxIndex.left = 0;
                    document.documentElement.scrollTop = document.getElementById(""+v.CXId[0].id+"").offsetTop;
                }else {
                    v.cxIndex.left --;
                    document.documentElement.scrollTop = document.getElementById(""+v.CXId[v.cxIndex.left].id+"").offsetTop;
                }
            }else {
                v.$Message.warning({
                    content: "啊嘞！您还没给我想查询的名字呢(っ °Д °;)っ",
                    duration: 3
                });
            }
        },
        nextright(){
            if (v.CXId !==undefined && v.CXId != null  && v.CXId.length > 0){
                if (v.cxIndex.right >= v.CXId.length){
                    v.$Message.warning({
                        content: "当前已经是最后一个了(っ °Д °;)っ",
                        duration: 3
                    });
                    v.cxIndex.right = v.CXId.length;
                    document.documentElement.scrollTop = document.getElementById(""+v.CXId[v.CXId.length-1].id+"").offsetTop;
                }else {
                    v.cxIndex.right ++;
                    // console.log(v.cxIndex.right,v.CXId.length)
                    document.documentElement.scrollTop = document.getElementById(""+v.CXId[v.cxIndex.right-1].id+"").offsetTop;
                }
            }else {
                v.$Message.warning({
                    content: "啊嘞！您还没给我想查询的名字呢(っ °Д °;)っ",
                    duration: 3
                });
            }
        },
        getPlNew(){
            this.plNew = true
            this.plHot = false
            axios.post("/gameart/artComment/"+this.artId).then(function (response){
                v.commentList = response.data
            })
        },
        getPlHot(){
            this.plHot = true
            this.plNew = false
            axios.post("/gameart/artCommentHot/"+this.artId).then(function (response){
                v.commentList = response.data
            })
        },
        upCom(){
            if (v.up.commentContent.includes("：")) {
                let aites = v.up.commentContent.split("：")
                v.up.aite = aites[0]
                v.up.commentContent = aites[1]
            }
            // let pl = document.getElementById("plsr").value;
            // pl.split(" ").join("").length < pl.length
            if(v.up.commentContent.includes("<script>")){
                v.up.commentContent = '';
                v.up.visitorName = '';
                v.up.userEmail = '';
                v.up.parentId = '';
                v.$Message.error({
                    content: "警告！请勿输入js代码 (╬▔皿▔)╯",
                    duration: 5
                });
            }else {
                if (v.up.commentContent !== '') {
                    // if (v.up.commentContent.length > 0 && v.up.commentContent.trim().length != 0){
                    if (v.adminName === '暮迟'){
                        axios.post("/gameart/upComment/"+this.artId +"/"+this.userSet+"/1", v.up).then(function (response) {
                            v.up.commentContent = '';
                            v.up.visitorName = '';
                            v.up.userEmail = '';
                            v.up.parentId = '';
                            axios.get("/gameart/artComment/" + v.artId).then(function (response) {
                                v.commentList = response.data
                            })
                        });
                        v.$Message.success({
                            content: "芜湖！评论成功φ(*￣0￣)",
                            duration: 5
                        });
                    }else {
                        if (v.up.visitorName !== '' && v.up.userEmail !== ''){
                            axios.post("/gameart/upComment/"+this.artId +"/"+this.userSet, v.up).then(function (response) {
                                v.up.commentContent = '';
                                v.up.visitorName = '';
                                v.up.userEmail = '';
                                v.up.parentId = '';
                                axios.get("/gameart/artComment/" + v.artId).then(function (response) {
                                    v.commentList = response.data
                                })
                            });
                            this.$Message.success({
                                content: "芜湖！评论成功φ(*￣0￣)",
                                duration: 5
                            });
                            this.showBox = false;
                        }else {
                            this.$Message.warning({
                                content: "提交的个人信息不能为空噢(✿◡‿◡)",
                                duration: 5
                            });
                        }
                    }
                    // }else {
                    //     this.$Message.warning({
                    //         content: "提交的评论信息不能为空格噢(✿◡‿◡)",
                    //         duration: 5
                    //     });
                    // }
                }else {
                    this.$Message.warning({
                        content: "提交的评论信息不能为空噢(✿◡‿◡)",
                        duration: 5
                    });
                }
            }
        },
        // plEdit(){
        //     // console.log(plNum)
        //     document.getElementById("plnum").innerText = document.querySelectorAll(".pl-one").length
        // },
        cxname(){
            let CXNAME = "@"+v.CX.cxName
            if (v.CX.cxName !== '') {
                axios.post("/gameart/cxname/"+this.artId +"/"+CXNAME).then(function (response) {
                    v.CX.cxName = '';
                    v.CXId = response.data
                    //标识评论
                    for (let i = 0;i<v.CXId.length;i++){

                        document.getElementById(""+v.CXId[i].id+"").classList.add("pl-bs")
                    }

                    if (v.CXId !==undefined && v.CXId != null  && v.CXId.length > 0){
                        v.$Message.success({
                            content: "芜湖！查询成功φ(*￣0￣)",
                            duration: 5
                        });
                        document.documentElement.scrollTop = document.getElementById(""+v.CXId[0].id+"").offsetTop;
                    }else {
                        v.$Message.warning({
                            content: "没有关于此名字的回复噢（；´д｀）ゞ",
                            duration: 5
                        });
                    }
                });

            }else {
                this.$Message.warning({
                    content: "提交的查询信息不能为空噢(✿◡‿◡)",
                    duration: 5
                });
            }
        },
        getEom(e){
            v.$refs.ywzs.classList.remove("bc-active")
            v.$refs.bilieoms.classList.remove("bc-active")
            v.$refs.bilifonts.classList.remove("bc-active")

            v.$refs.eoms.classList.add("bc-active")
            v.eomPT = true
            let eom =e.target.offsetTop
            v.$refs.eomBox.style.top = ""+(eom+30)+"px"
            //普通eom
            axios.get("/gameart/eom").then(function (response){
                v.eomList = response.data
            })
            document.addEventListener("click",e => {
                if (v.$refs.eomClick.contains(e.target)){
                    v.showEomBox = true
                }else {
                    v.showEomBox = false
                }
            })
        },
        eom(e){
            v.eomPT = true
            v.bilieom =false
            // v.biliwz = false
            v.$refs.ywzs.classList.remove("bc-active")
            v.$refs.bilieoms.classList.remove("bc-active")
            v.$refs.bilifonts.classList.remove("bc-active")
            v.$refs.eomTitle.textContent = "emo表情"
            v.$refs.eoms.classList.add("bc-active")
            //普通eom
            axios.get("/gameart/eom").then(function (response){
                v.eomList = response.data
            })
        },
        ywz(e){
            v.eomPT = true
            v.bilieom =false
            // v.biliwz = false
            v.$refs.eoms.classList.remove("bc-active")
            v.$refs.bilieoms.classList.remove("bc-active")
            v.$refs.bilifonts.classList.remove("bc-active")
            v.$refs.eomTitle.textContent = "颜文字表情"
            v.$refs.ywzs.classList.add("bc-active")
            //普通eom
            axios.get("/gameart/ywz").then(function (response){
                v.eomList = response.data
            })
        },
        biliEom(e){
            v.eomPT = false
            v.bilieom =true
            // v.biliwz = false
            v.$refs.ywzs.classList.remove("bc-active")
            v.$refs.eoms.classList.remove("bc-active")
            v.$refs.bilifonts.classList.remove("bc-active")
            v.$refs.eomTitle.textContent = "引用至B站emo表情"
            v.$refs.bilieoms.classList.add("bc-active")
            //普通eom
            axios.get("/gameart/bilieom").then(function (response){
                v.biliList = response.data
            })
        },
        biliWZ(e){
            v.eomPT = false
            v.bilieom = true
            // v.biliwz = true
            v.$refs.eoms.classList.remove("bc-active")
            v.$refs.bilieoms.classList.remove("bc-active")
            v.$refs.ywzs.classList.remove("bc-active")
            v.$refs.eomTitle.textContent = "引用至B站文字表情"
            v.$refs.bilifonts.classList.add("bc-active")
            //普通eom
            axios.get("/gameart/biliwz").then(function (response){
                v.biliList = response.data
            })
        },
        yiru(e){
            e.classList.add('shake-bottom')
            e.classList.add('eom-span-show')

        },
        yichu(e){
            e.classList.remove('shake-bottom')
            e.classList.remove('eom-span-show')

        },
        // eomsr(index){
        //     let getEom = document.getElementById("eom"+index+"").innerText
        //     v.textData.textChaRu = getEom
        //     let textArt = document.getElementById("plsr")
        //     v.textData.startText = textArt.selectionStart
        //     v.textData.endText = textArt.selectionEnd
        //     textArt.value = textArt.value.substring(0,v.textData.startText)+v.textData.textChaRu+textArt.value.substring(v.textData.startText,textArt.value.length)
        //     textArt = this.$nextTick() // 这句是重点, 圈起来
        //     textArt.focus()
        //
        //
        // },
        eomsr(index) {
            v.textData.textChaRu = document.getElementById("eom" + index + "").innerText
            let myField = document.getElementById("plsr")
            myField.focus()
            v.textData.startText = myField.selectionStart
            v.textData.endText = myField.selectionEnd
            if (v.textData.startText || v.textData.startText !== 0) {
                v.up.commentContent = myField.value.substring(0, v.textData.startText) + v.textData.textChaRu + myField.value.substring(v.textData.endText, myField.value.length)
                this.$nextTick() // 这句是重点, 圈起来
                myField.setSelectionRange(v.textData.startText + v.textData.textChaRu.length, v.textData.endText + v.textData.textChaRu.length)
            } else {
                v.up.commentContent += v.textData.textChaRu
            }
        },
        eomsr2(index) {
            let img = document.getElementById("bili" + index + "")
            let imgHtml = "<img src='"+img.src+"' width='35px'/>"
            // console.log(document.getElementById("bili" + index + "").src)
            let myField = document.getElementById("plsr")
            myField.focus()
            v.textData.startText = myField.selectionStart
            v.textData.endText = myField.selectionEnd
            if (v.textData.startText || v.textData.startText !== 0) {
                v.up.commentContent = myField.value.substring(0, v.textData.startText) + imgHtml + myField.value.substring(v.textData.endText, myField.value.length)
                // this.$nextTick() // 这句是重点, 圈起来
                // myField.setSelectionRange(v.textData.startText + v.textData.textChaRu.length, v.textData.endText + v.textData.textChaRu.length)
            } else {
                v.up.commentContent += imgHtml
            }
        },
    }
})


let c = new Vue({
    el: "#downApp",
    data: {
        downLoadList:[],
        showQiTao:false,
        artUrl:'',
        instJc:[]
    },
    created:function (){
        axios.post("/gameart/downloadList/"+v.artId).then(function (response){
            c.downLoadList = response.data
        })
        axios.post("/gameart/instJc/"+v.artId).then(function (response){
            c.instJc = response.data
        })
        this.artUrl = window.location.href
    },
    methods:{
        yiru(e){
            e.classList.add('but-state')
        },
        yichu(e){
            e.classList.remove('but-state')
        },

    }
})

let b = new Vue({
    el:"#nav-box",
    data:{
        navflag:false,
        flag:true,
        nightFlag:false,
        timeh:null,
        newHour:0,
        scrollTop:0
    },
    methods:{
        windowScrolls(){
            this.scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
            if (this.scrollTop >= 475){
                this.navflag = true
            }else {
                this.navflag = false
            }
            // if (this.scrollTop >= document.documentElement.clientHeight-1070){
            //     // axios.get("/artComment/"+v.artId).then(function (response){
            //     //     v.commentList.push(response.data)
            //     // })
            //     console.log("总高度"+document.body.scrollHeight)
            //     console.log("xz"+this.scrollTop)
            // }
        },
        windowScroll(){
            this.scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
        },
        navclick(){
            if (this.flag){
                window.removeEventListener("scroll",this.windowScrolls)
                window.addEventListener("scroll",this.windowScroll)
                this.navflag = false
                this.flag = !this.flag
            }else {
                window.addEventListener("scroll",this.windowScrolls)
                if (this.scrollTop >= 475){
                    this.navflag = true
                }else {
                    this.navflag = false
                }
                this.flag = !this.flag
            }
        },
        settingreset(){
            this.flag = false
            window.removeEventListener("scroll",this.windowScrolls)
            window.addEventListener("scroll",this.windowScroll)
            this.navflag = false

            this.nightFlag = false
        },
        startInterval(){
            clearInterval(this.timeh)
            this.timeh = setInterval(()=>{
                // console.log(plNum)
                document.getElementById("plnum").innerText = document.querySelectorAll(".pl-one").length
                document.getElementById("plnum2").innerText = document.querySelectorAll(".pl-one").length
            },10)
        },

    },
    mounted(){
        window.addEventListener("scroll",this.windowScrolls)

        this.startInterval()

    },
    beforeDestroy(){
        window.removeEventListener("scroll",this.windowScrolls)
        window.removeEventListener("scroll",this.windowScroll)
        this.navflag = false
        this.flag = !this.flag
        clearInterval(this.timeh)
    }
})


function setting(){
    let setting = document.getElementById('set-all')
    let svg = document.getElementById('rotate-svg')
    if (setting.classList.contains('active')) {
        setting.classList.remove('active')
        setting.classList.remove('setting-open')
        setting.classList.add('setting-close')
        clearInterval(rotate.time)
    } else {
        setting.classList.add('active')
        setting.classList.remove('setting-close')
        setting.classList.add('setting-open')
        rotate(svg,180,10)
    }
}

//旋转
function rotate(obj,direction,speed){//对象，方向，速度，
    var rotateVal=0
    var dir=direction!==undefined?direction:true
    var spe=speed||0.1
    rotate.time = setInterval(function() {
        rotateVal += 1;
        obj.style.transform = 'rotateZ('+(dir?"+":"-") + rotateVal+ 'deg)';
        if(rotateVal>360)
            rotateVal=0
    },0)
}

function backclick(){
    document.documentElement.scrollTop = 0;
}

function plclick(){
    document.documentElement.scrollTop = document.getElementById("pl").offsetTop;
}

let year = document.getElementById("newyear")
year.innerText = ""+new Date().getFullYear()+""

// function qqkj(){
//     let arttitles = document.getElementById("arttitle").innerText
//     let arttitle = trimAll(arttitles)
//     let imgmain = document.getElementById("imgmain").src
//     console.log(arttitle,imgmain)
//     window.open("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+encodeURIComponent(window.location.href)+"&showcount=1&title="+arttitle)
// }
//
// function trimAll(ele){
//     if(typeof ele === 'string'){
//         return ele.split(' ').join('');
//
//     }else{
//         console.error(`${typeof ele} is not the expected type, but the string type is expected`)
//     }
//
// }

let f = new  Vue({
    el:"#navbox",
    data:{

    },
    methods:{
        wxandqq(){
            let host = window.location.href
            let title = document.getElementById("arttitle").innerText
            let url = "【暮迟的游戏小屋】  "+title+"  "+host;
            this.copyToClipboard(url)
            v.$Message.success({
                content: "复制成功！快去粘贴吧！",
                duration: 3
            });
        },
        // 点击复制到剪贴板函数
        copyToClipboard(content) {
            if (window.clipboardData) {
                window.clipboardData.setData('text', content);
            } else {
                (function (content) {
                    document.oncopy = function (e) {
                        e.clipboardData.setData('text', content);
                        e.preventDefault();
                        document.oncopy = null;
                    }
                })(content);
                document.execCommand('copy');
            }
        },

    }
})


//展开隐藏
function videohide(){
    let videowhite = video.offsetWidth
    let hidets = document.getElementById("hidets")
    if (video.classList.contains('active')) {
        video.classList.remove('active')
        video.style.transform = 'translateX(' + 0 + 'px)'
        hidets.innerHTML = "收起"
    } else {
        video.classList.add('active')
        video.style.transform = 'translateX(' + videowhite + 'px)'
        hidets.innerHTML = "展开"
    }
}